package com.bubblegumproject.ogo.swing;

import com.bubblegumproject.ogo.action.TypeParameterizedAction;

/**
 * Action generated when a user does something that triggers some new UIActivity.
 *
 * @author Azubuko Obele (buko.obele@gmail.com)
 */
public class UIActivityTriggeredAction<T extends UIActivity> extends UIActivityAction
        implements TypeParameterizedAction {

    private Class<T> uiActivityClass;

    public UIActivityTriggeredAction(Class<T> uiActivityClass) {
        assert(uiActivityClass != null);
        this.uiActivityClass = uiActivityClass;
    }

    public Class<T> getUIActivityClass() {
        return uiActivityClass;
    }


    public Class getTypeParameter() {
        return uiActivityClass;
    }

    public static  <U extends UIActivity> UIActivityTriggeredAction<U> UIActivityTriggered(Class<U> clazz) {
        return new UIActivityTriggeredAction<U>(clazz);
    }
}
